package com.study.java.jinjie.jihe.lianxi.one;

public class Student {
    private int num;  // 学号
    private String name;  // 姓名
    private short score;  // 成绩


    public Student(int num, String name, short score) {
        this.num = num;
        this.name = name;
        this.score = score;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public short getScore() {
        return score;
    }

    public void setScore(short score) {
        if (score>100){
            score = -1;
        } else {
            this.score = score;
        }

    }

    @Override
    public String toString() {
        return "Student{" +
                "num=" + num +
                ", name='" + name + '\'' +
                ", score=" + score +
                '}';
    }
}
